package com.itwill.ecom.boardReply;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository("boardReplyDao")
public class BoardReplyDaoImpl implements BoardReplyDao {
	public final static String namespace="com.itwill.ecom.boardReply.BoardReplyMapper";
	@Autowired
	private SqlSession session;

	public SqlSession getSession() {
		return session;
	}

	public void setSession(SqlSession session) {
		System.out.println("#### BoardReplyDao() : setSession()");
		this.session = session;
	}
	
	public BoardReplyDaoImpl() {
		System.out.println("#### BoardReplyDao() : 디폴트생성자 호출  ");
	}

	@Override
	public int create(BoardReplyBeans reply){
		return session.insert(namespace + ".create", reply);
	}

	@Override
	public List<BoardReplyBeans> readByBoardNo(int boardno){
		return session.selectList(namespace + ".readByBoardNo", boardno);
	}

	@Override
	public int updateContent(HashMap<String, String> contentMap){
		return session.update(namespace + ".updateContent", contentMap);
	}

	@Override
	public int updateRecommend(int replyno){
		return session.update(namespace + ".updateRecommend", replyno);
	}

	@Override
	public int delete(int replyno){
		return session.delete(namespace + ".delete", replyno);
	}
}
